import { config } from "../config/config";
import { promisic } from "./util";

class Http {
  static async request({ url, data = {}, method = "GET" }) {
    const res = await promisic(wx.request)({
      url: `${config.apiBaseUrl}${url}`,
      data,
      method,
      header: {
        clientkey: config.appKey,
        Host: "api.sleeve.talelin.com",
        "content-type": "application/json",
        appkey: "",
      },
    });
    // console.log("---------------------------");
    // console.log(
    //   `*********请求返回结果******** \n 接口URL：${url} \n 返回值：`,
    //   res
    // );
    return res.data;
  }
}

export { Http };
